'use strict';

/**
 * 登录控制类
 */
 const Controller = require('egg').Controller;
 const fs = require('fs');
 class LoginController extends Controller {

   async login () {
    const {ctx} = this;
    let data = ctx.request.body;
    console.log('data'+JSON.stringify(data))
    // let fileData = await fs.readFileSync(process.cwd()+'/app/public/login.json','utf8');
    // if(data.userName === 'admin'){
    //   ctx.body = JSON.parse(fileData).admin;
    // }else{
    //   ctx.body = JSON.parse(fileData).user;
    // }
    let result = await ctx.service.login.authLogin(data);
    ctx.body = result;
   }
 }

 module.exports = LoginController;
